<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=utf-8" errorPage="/error.jsp" isELIgnored="false" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://www.opensymphony.com/oscache" prefix="cache" %>
<%@ taglib uri="http://atleap.blandware.com/taglib" prefix="atleap" %>
<html:xhtml />

<atleap:constants className="com.blandware.atleap.webapp.util.core.WebappConstants" var="OWNER_INFO_KEY" scope="page" />
<atleap:content identifier="information" ignore="true" />

<atleap:isUserInRole roles="core-sequenceItem-update" var="canUpdate" />

<table cellpadding="0" cellspacing="0" border="0" class="tableView">
    <tr>
        <th><atleap:message key="core.sequenceItem.form.sequenceOwnerInfo" /></th>
        <td>${sessionScope[pageScope.OWNER_INFO_KEY]}</td>
    </tr>
    <tr>
        <th><atleap:message key="core.sequenceItem.form.sequenceIdentifier" /></th>
        <td><c:out value="${requestScope.sequenceItem.sequence.identifier}" escapeXml="true" /></td>
    </tr>
    <tr>
        <th><atleap:message key="core.sequenceItem.form.sequenceType" /></th>
        <td><atleap:message key="core.sequence.form.type.${requestScope.sequenceItem.sequence.type}" /></td>
    </tr>
    <tr>
        <th><atleap:message key="core.sequenceItem.form.object" /></th>
        <td>
            <c:set var="objectInfo">
                <c:choose>
                    <c:when test="${requestScope.sequenceItem.page != null}">
                        <atleap:localizableInfo localizable="${requestScope.sequenceItem.page}" />
                        <c:set var="objectId" value="${requestScope.sequenceItem.page.id}"/>
                    </c:when>
                    <c:otherwise>
                        <c:out value="${requestScope.sequenceItem.contentResource.uri}" escapeXml="true" />
                        <c:set var="objectId" value="${requestScope.sequenceItem.contentResource.id}"/>
                    </c:otherwise>
                </c:choose>
            </c:set>
            <c:choose>
                <c:when test="${!empty objectViewAction}">
                    <atleap:link action="${objectViewAction}">
                        <atleap:param name="id" value="${objectId}"/>
                        ${objectInfo}
                    </atleap:link>
                </c:when>
                <c:otherwise>
                    ${objectInfo}
                </c:otherwise>
            </c:choose>
        </td>
    </tr>
</table>
<atleap:form action="core/sequenceItem/callUpdate" method="GET" validateOnSubmit="false">
    <html:hidden property="id" value="${requestScope.sequenceItem.id}" />

    <c:if test="${canUpdate}">
        <atleap:submit styleClass="button"><atleap:message key="core.commons.buttons.callUpdate" /></atleap:submit>
    </c:if>

    <html:hidden property="sequenceId" value="${requestScope.sequenceItem.sequence.id}" />
    <atleap:cancel styleClass="button"><atleap:message key="core.commons.buttons.showList" /></atleap:cancel>
</atleap:form>
